package admincow.servlet.usuario;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admincow.dao.UsuarioDAO;
import admincow.vo.UsuarioVO;

/**
 * Servlet implementation class for Servlet: UsuarioModificarServlet
 * 
 */
public class UsuarioModificarServlet extends javax.servlet.http.HttpServlet
		implements javax.servlet.Servlet {
	static final long serialVersionUID = 1L;

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public UsuarioModificarServlet() {
		super();
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request,
	 *      HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		String a = request.getParameter("idUsuario");
		String b = request.getParameter("clave");
		String c = request.getParameter("nombres");
		String d = request.getParameter("paterno");
		String e = request.getParameter("materno");
		String f = request.getParameter("correo");
		String g = request.getParameter("direccion");
		String h = request.getParameter("telefono");
		String i = request.getParameter("estado");
		String j = request.getParameter("foto");
		String k = request.getParameter("funcion");
		
		UsuarioVO vo = new UsuarioVO();
		vo.setIdusuario(a);
		vo.setPassword(b);
		vo.setNombres(c);
		vo.setPaterno(d);
		vo.setMaterno(e);
		vo.setCorreo(f);
		vo.setDireccion(g);
		vo.setTelefono(h);
		vo.setEstado(i);
		vo.setFoto(j);
		vo.setNom_fun(k);
		System.out.println(i);
		System.out.println(j);
		
		UsuarioDAO dao = new UsuarioDAO();
		dao.actualizar(vo);

		RequestDispatcher rd = request
				.getRequestDispatcher("/usuarioBuscar.jsp");
		rd.forward(request, response);

	}
}